${r"<"}#include "/common/tags.ftl" />
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>${comments!}</title>
        ${r"<"}@zc.link href="style.css" />
        ${r"<"}@zc.script src="jquery.js" />
        ${r"<"}@zc.script src="Public.js" />
        ${r"<"}@zc.script src="CheckText.js" />
        ${r"<"}@zc.iniCalendar />
        <script type="text/javascript">
            $(document).ready(function(){
                $("#btSave").click(function(){
                    $("#btSave").attr("disabled", true);
                    var varAction = "${r"${"}ctx}/${packageName!}/${className!}/save${className?cap_first!}.do";
                    $.ajax({
                        cache: true,
                        type: "post",
                        url:varAction,
                        data:$('#dataForm').serialize(),
                        async: true,
                        dataType: "json",
                        timeout:5000,
                        error: function(request) {
                            $("#btSave").attr("disabled", false);
                            alert("网络异常");
                        },
                        success: function(data) {
                            $("#btSave").attr("disabled", false);
                            alert(data.msg);
                            if(data.status == 1){
                                $("#id").val($("#${className!}id").val());
                            }
                        }
                    });
                });
                <#if (lcmc?? && lcmc != '')>
                $("#btSubmit").click(function(){
                    if(!checkData(dataForm))return;
                    if(!confirm("提交后，信息不允许修改，是否确认提交？")) return;
    
                    $("#btSubmit").prop("disabled", true);
                    var varAction = "${r"${"}ctx}/${packageName!}/${className!}/preSubmit${className?cap_first!}.do";
    
                    $.preSubmit({
                        url: varAction,
                        bbh: '${r"$"}{(zc:lcbbh(misCons.${lcmc!}))!}',
                        data: $('#dataForm').serialize(),
                        error: function (request) {
                            alert("网络异常");
                            $("#btSubmit").prop("disabled", false);
                        },
                        success: function (data) {
                            $("#btSubmit").prop("disabled", false);
    
                        },
                        view : function (data){
                            $("#btSubmit").prop("disabled", false);
                            if(data.status == 1){
                                var varAction = "${r"${"}ctx}/${packageName!}/${className!}/view${className?cap_first!}.do";
                                $("#dataForm").attr("action", varAction).attr("target", "_self").submit();
                            }else{
                                alert(data.msg) ;
                            }
                        }
                    });
                });
                </#if>
            });
            function ywspSubmit(){
                if(!checkData(dataForm)) return;
                if(!checkYwspData(dataForm)) return;
                var varAction = "${r"${"}ctx}/${packageName!}/${className!}/forward.do";
                dataForm.action = varAction;
                dataForm.target = "_self";
                dataForm.submit();
            }
            function checkData(dataForm) {
                if (!checkFormItem(dataForm.xmmc, "C", 100, 0, 5, "投标项目名称")) return false;
                if (!checkFormItem(dataForm.tbsj, "C", 32, 0, 5, "投标日期"))return false;
                if (!checkFormItem(dataForm.cgfs, "C", 32, 0, 5, "采购方式"))return false;
    
                return true;
            }
            function save${className?cap_first!}(){
                var varAction = "${r"${"}ctx}/${packageName!}/${className!}/save${className?cap_first!}.do";
                $.ajax({
                    cache: true,
                    type: "post",
                    url:varAction,
                    data:$('#dataForm').serialize(),
                    async: true,
                    dataType: "json",
                    timeout:5000,
                    error: function(request) {
                        alert("网络异常");
                    },
                    success: function(data) {
                        if(data.status == 1){
                            $("#id").val($("#${className!}id").val());
                        }
                    }
                });
            }
        </script>
    </head>
    <body>
        <form id="dataForm" name="dataForm" method="post">
            <input type="hidden" id="id" name="id" value="${r"$"}{(${className!}.id)!}">
            <input type="hidden" id="${className!}id" name="${className!}id" value="${r"$"}{(${className!}id)!}">
            <div class="wcolumn line">
                <div class="column">
                    <span class="title bg1">${comments!}</span>
                </div>
            </div>
            <table class="table table-edit">
                <tr>
                    <td class="tright" style="width: 120px;">
                        <span class="hot">*</span>投标项目名称：
                    </td>
                    <td class="tleft">
                        <input type="text" class="form-control" id="xmmc" name="xmmc" value="${r"$"}{(${className!}.xmmc)!}" />
                    </td>
                </tr>
                <tr>
                    <td class="tright">
                        <span class="hot">*</span>投标日期：
                    </td>
                    <td class="tleft">
                        <zc:Calendar id="tbsj" name="tbsj" value="${r"$"}{(${className!}.tbsj)!}"/>
                    </td>
                </tr>
                <tr>
                    <td class="tright">
                        <span class="hot">*</span>采购方式：
                    </td>
                    <td class="tleft">
                        <zc:Radio name="cgfs" dmlb="CGFS" valueField="dmbs" textField="dmmc" value="${r"$"}{(${className!}.cgfs)!}"/>
                    </td>
                </tr>
                <tr>
                    <td class="tright">备注说明：</td>
                    <td class="tleft">
                        <textarea class="form-control" id="bzsm" name="bzsm" style="width: 500px;">${r"$"}{(${className!}.bzsm)!}</textarea>
                    </td>
                </tr>
            </table>
        
            <div class="btm-panel-content">
                <div class="btm-panel btm">
                    <input type="button" id="btSave" name="btSave" class="btn btn4 btn-save" value="保存信息" />
                    <#if (lcmc?? && lcmc != '')>
                    <input type="button" id="btSubmit" name="btSubmit" class="btn btn4 btn-submit" value="完成提交" />
                    </#if>
                </div>
            </div>
            <zcx:ywsp />
        </form>
    </body>
</html>
